﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.IO;
using System.ComponentModel;
using System.Web.Configuration;
using System.Web.Security;


namespace Village_Project
{
    public partial class findchild : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {


            if (!IsPostBack)
            {

                BindData();
                Session["CID"] = null;
                Session["LastName"] = null;
                Session["FirstName"] = null;
                Session["CaseNo"] = null;
                Session["PSNumber01"] = null;


            }


        }


        private void MessageBox(string msg)
        {
            Label lbl = new Label();
            lbl.Text = "<script language='javascript'>" + Environment.NewLine + "window.alert('" + msg + "')</script>";
            Page.Controls.Add(lbl);





        }





        protected void BindData()
        {
            string constr = WebConfigurationManager.ConnectionStrings["strconnection"].ConnectionString;
            SqlConnection scon = new SqlConnection(constr);

            scon.Open();

            SqlCommand cmd = new SqlCommand("SELECT a.CID as CID,a.FirstName as FirstName,a.LastName as LastName,b.WelfareDescription as DisabilityType FROM Person a join WelfareCategory b on a.title=b.WelfareID where a.CID like @text or a.FirstName like @text", scon);
            cmd.Parameters.AddWithValue("@text", "%" + Session["find"] + "%");



            DataSet dsf = new DataSet();
            SqlDataAdapter daf = new SqlDataAdapter(cmd);
            daf.Fill(dsf);
            childlist.DataSource = dsf;
            childlist.DataBind();
            scon.Close();




        }

        protected void familylist_SelectedIndexChanged(object sender, GridViewPageEventArgs e)
        {
            childlist.PageIndex = e.NewPageIndex;
            BindData();
        }


        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }
        protected void CaseSelector3_CheckedChanged(object sender, EventArgs e)
        {

     



        }

       

        protected void Button3_Click(object sender, EventArgs e)
        {
            Session["CID"] = null;
            Response.Redirect("~/reg.aspx");



        }

    }
}